package com.yikes.srb.service;

import com.yikes.srb.common.result.PageResult;
import com.yikes.srb.leadingModle.form.borrowinfo.BorrowInfoAddForm;
import com.yikes.srb.leadingModle.form.borrowinfo.BorrowInfoApprovalForm;
import com.yikes.srb.leadingModle.form.borrowinfo.BorrowInfoEditForm;
import com.yikes.srb.leadingModle.form.borrowinfo.BorrowInfoQuery;
import com.yikes.srb.leadingModle.vo.BorrowInfoVO;
import com.yikes.srb.pojo.entity.BorrowInfo;
import com.baomidou.mybatisplus.extension.service.IService;
import jakarta.validation.Valid;

import java.math.BigDecimal;
import java.util.Map;

/**
 * <p>
 * 借款信息表 服务类
 * </p>
 *
 * @author guanrong.yin
 * @since 2024-12-03
 */
public interface BorrowInfoService extends IService<BorrowInfo> {

    /**
     * 列表
     *
     * @param query
     * @return
     */
    PageResult<BorrowInfoVO> listPage(BorrowInfoQuery query);

    /**
     * 根据id查询单条信息
     *
     * @param id
     * @return
     */
    BorrowInfoVO infoId(Long id);

    /**
     * 新增
     * @param form
     */
    void create(@Valid BorrowInfoAddForm form);

    /**
     * 编辑
     * @param form
     */
    void edit(@Valid BorrowInfoEditForm form);

    /**
     * 删除
     * @param id
     */
    void del(Long id);

    /**
     * 获取借款额度
     * @param userId
     * @return
     */
    BigDecimal getBorrowAmount(Long userId);

    /**
     * 提交借款申请
     * @param form
     * @param userId
     */
    void saveBorrowInfo(BorrowInfoAddForm form, Long userId);

    /**
     * 获取借款申请审批状态
     * @param userId
     * @return
     */
    Integer getStatusByUserId(Long userId);

    /**
     * 获取借款信息
     * @param id
     * @return
     */
    Map<String, Object> getBorrowInfoDetail(Long id);

    /**
     * 审批借款信息
     * @param form
     */
    void approval(BorrowInfoApprovalForm form);
}
